﻿using System.Configuration;
using System.Data;
using System.Windows;
using Serilog;

namespace ToolApp
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Information()
                .WriteTo.File($"log\\{DateTime.Now:yyyy-MM-dd}.txt",
                    outputTemplate: "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
                .CreateLogger();

            Log.Verbose("WPF application started.");
        }

        protected override void OnExit(ExitEventArgs e)
        {
            Log.Verbose("WPF application exiting.");
            Log.CloseAndFlush();

            base.OnExit(e);
        }
    }

}
